Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a GitHub Actions workflow to automatically sync repository labels from a centralized labels.yml file hosted in the groundsgg/.github repository. The workflow helps maintain consistent labeling across repositories in the organization.
- Adds automated label synchronization triggered by changes to the workflow file, pull requests, or manual dispatch
- Downloads label configuration from a central repository to maintain consistency
- Uses dry-run mode for pull requests to preview changes without applying them
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| steps: | ||
| - name: 📦 Download labels.yml | ||
| run: | | ||
| curl -fsSL "https://raw.githubusercontent.com/groundsgg/.github/refs/heads/main/.github/labels.yml" -o labels.yml |
There was a problem hiding this comment.
The URL uses 'refs/heads/main' which is verbose. GitHub's raw content URLs work more reliably with just the branch name 'main'. Consider using 'https://raw.githubusercontent.com/groundsgg/.github/main/.github/labels.yml' instead for better compatibility and clarity.
| curl -fsSL "https://raw.githubusercontent.com/groundsgg/.github/refs/heads/main/.github/labels.yml" -o labels.yml | |
| curl -fsSL "https://raw.githubusercontent.com/groundsgg/.github/main/.github/labels.yml" -o labels.yml |
| - name: 📦 Download labels.yml | ||
| run: | | ||
| curl -fsSL "https://raw.githubusercontent.com/groundsgg/.github/refs/heads/main/.github/labels.yml" -o labels.yml | ||
|
|
There was a problem hiding this comment.
The workflow downloads labels.yml from an external repository but doesn't verify the download succeeded or validate the file content before using it. If the download fails silently or returns invalid content, the labeler action may behave unexpectedly. Consider adding a validation step to check that the file exists and contains valid YAML before proceeding to the sync step.
| - name: ✅ Validate labels.yml | |
| run: | | |
| if [ ! -s labels.yml ]; then | |
| echo "Error: labels.yml was not downloaded or is empty." | |
| exit 1 | |
| fi | |
| # Validate that labels.yml contains syntactically valid YAML | |
| ruby -ryaml -e "YAML.load_file('labels.yml')" || { | |
| echo "Error: labels.yml is not valid YAML." | |
| exit 1 | |
| } |
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| yaml-file: labels.yml | ||
| dry-run: ${{ github.event_name == 'pull_request' }} | ||
| skip-delete: false |
There was a problem hiding this comment.
Setting 'skip-delete: false' means labels not in the source file will be permanently deleted from the repository. This could be destructive if the downloaded labels.yml is incomplete or if there are repository-specific labels. Consider setting this to 'true' or adding a comment explaining why deletion is safe in this context.
| skip-delete: false | |
| skip-delete: true # Avoid deleting repository-specific labels not present in labels.yml |
| exclude: | | ||
| help* | ||
| *issue | ||
| autorelease* No newline at end of file |
There was a problem hiding this comment.
The exclude patterns may not work as intended. The pattern 'issue' will exclude labels ending with 'issue', but 'help' and 'autorelease*' use prefix wildcards. Without documentation explaining what labels these patterns are meant to protect, it's unclear if this configuration is correct. Consider adding a comment explaining which specific labels should be excluded and why.
Pull Request
Description
Type of Change
Related Issues
Testing
Checklist